from pydantic import BaseModel, Field

from fastapiApp.models.enums import MethodType,AGVStatus


class BaseAGVcar(BaseModel):
    agv_index: int = Field(1,description="AGV编号 0-255")
    agv_type : str = Field(...,description="AGV类型",example="3MC_15")
    remote_host: str = Field(..., description="IP地址", example="127.0.0.1")
    local_port: int = Field(..., description="本地端口", example=30000)
    remote_port: int = Field(..., description="远程端口", example=20000)
    timeout: int = Field(..., description="超时响应 ms", example=3000)
    timesend: int = Field(..., description="发送间隔 ms", example=1000)
    isenable: int = Field(1, description="是否启用")


class AGVcarCreate(BaseAGVcar): ...


class AGVcarUpdate(BaseAGVcar):
    id: int

class AGVsimulationCreat(BaseModel):
    car_index: int = Field(...,description="AGV编号 0-255",example=1)
    x : int = Field(0,description="x坐标")
    y : int = Field(0,description="y坐标")
    angle : int = Field(0,description="角度")
    speed : int = Field(10,description="速度")
    is_connected : int = Field(1,description="是否连接")
    status : str = Field(AGVStatus.IDLE,description="状态")
    battery : int = Field(95,description="电池电量")
    node_start_id : int = Field(None,description="起始节点id")
    node_to_id : int = Field(None,description="目标节点id")
    simulation: int = Field(1,description="是否模拟设备")
